<?php if(!defined('A')) exit;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站内容管理系统</title>
<?php
loadcss(array('reset','shell'));
loadcss(array('smart_pager','glDatePicker'),P_CSS);
loadjs(array('jquery','smart_pager','glDatePicker'),P_JS);
loadjs(array('tab','util','table'));
?>
<script type="text/javascript">
$(document).ready(function(e) {
var smallNowTab;
var pt = new Tabs();
pt.classpre="smalltab_";
pt.container = "smalltab_container";
pt.createTab("t1","留言列表","",true,"n");
pt.init = function(){
	smallNowTab = pt.nowTab;
};
pt.onclick = function(){
	smallNowTab = pt.nowTab;
};		
pt.initTab();
pt.clickNowTab();    


$('#ts_1').glDatePicker();
$('#ts_2').glDatePicker();

});
$(document).ready(function(){
		 //全选
     $("#CheckedAll").click(function(){
	     $("[name='items[]']:checkbox").attr('checked', true);
	 });
	 //全不选
     $("#CheckedNo").click(function(){
	    $('[type=checkbox]:checkbox').attr('checked', false);
	 });
	 //反选
     $("#CheckedRev").click(function(){
		  $("[name='items[]']:checkbox").each(function(){
			this.checked=!this.checked;
		  });
	 });
	$('#myform').submit(function(){
		var l=$("[name='items[]']:checkbox:checked");
		if(l.length==0){
			alert('请选择一项！');
			$(this).get(0).reset();
			return false;
		}
		return true;
	});
	$('#op_1').click(function(){
		$('#myform').attr('action','<?php echo url('guestbook','del');?>');	
	});
});
</script>
<style>
body{margin:10px;}
</style>
</head>
<body>
<table class="settop">
<tr>
<td class="settop_left">
&nbsp;&nbsp;
</td>
<td>
<div id="smalltab_container"></div>
</td>
</tr>
</table>
<div class="smalltab_line"></div>
<div id="t1">
<br />

<form action="?" method="get">
<table width="100%" border="1" cellspacing="0" cellpadding="0" class="mytable">
  <tr>
    <td align="center">
    状态：
    <select name="type" id="">
	<?php echo form_select($type_arr,$type);?>
    </select>
    <br />
	添加时间：<input name="ts_1" id="ts_1" type="text" class="input2" value="<?php echo $ts_1?>" />
    - <input name="ts_2" id="ts_2" type="text" class="input2" value="<?php echo $ts_2?>" />
<br />
<input name="submit" type="submit" class="color_btn color_btn_yellow" value="搜索" />
    </td>
  </tr>
</table>
</form>
<br />
<form id="myform" action="<?php echo url('guestbook','bit_op');?>" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mytable">
<?php
if(!empty($return)){
?>
  <tr>
    <td align="center">&nbsp;</td>
    <td align="center">ID</td>
    <td align="center">标题</td>
    <td align="center">留言内容</td>
    <td align="center">IP</td>
    <td align="center">时间</td>
    <td align="center">删除</td>
  </tr>
<?php 
foreach($return[0] as $k=>$v){
?>
  <tr>
    <td align="center"><input type="checkbox" name="items[]" value="<?php echo $v['id']; ?>" /></td>
    <td align="center"><?php echo $v['id']; ?></td>
    <td align="center"><?php echo htmlspecialchars($v['title']);?></td>
    <td align="center"><textarea rows="5" cols="50"><?php echo htmlspecialchars($v['content']);?></textarea></td>
    <td align="center"><?php echo $v['ip'];?></td>
    <td align="center"><?php echo date('Y-m-d H:i:s',$v['timestring']);?></td>
    <td align="center"><a href="<?php echo url('guestbook','del','id='.$v['id']);?>" onclick="return confirm('确定要删除么？');"><img src="<?php echo PROJECT_IMG_URL;?>shanchu.gif" alt="" /></a></td>
  </tr>
<?php
}
?>
  <tr>
    <td colspan="7" align="center"><?php echo $return[1];?></td>
    </tr>
  <tr>
    <td colspan="7" align="center">
<input type="button" id="CheckedAll" value="全　选"/>
    <input type="button" id="CheckedNo" value="全不选"/>
    <input type="button" id="CheckedRev" value="反　选"/> 
    <br />
    选中项 ：<input type="submit" id="op_1" value="删除" onclick="return confirm('确定要删除么？');"/>
    </td>
  </tr>
<?php
}else{
?>

  <tr>
    <td colspan="7" align="center">无内容！<a href="<?php echo url('guestbook','mylist');?>">返回列表</a></td>
    </tr>
<?php
}
?>
</table>
</form>
</div>
</body>
</html>